<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>玩家实时在线统计</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/public.css" media="all">
</head>
<body>
<div class="layuimini-container" id="app">
    <div class="layuimini-main">
        <fieldset class="table-search-fieldset">
            <legend>在线人数</legend>
            <div style="margin: 10px 10px 10px 10px">
                <div class="layui-form layui-form-pane" action="javascript:;" lay-filter="table-search">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <button type="button" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i>刷 新</button>
                        </div>
                    </div>
                </div>
            </div>
        </fieldset>
    </div>
</div>

<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>

<script type="text/html" id="currentTableBar">
</script>
<script src="/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/js/common.js?v=5" charset="utf-8"></script>
<script src="/xm-select-v1.2.4/xm-select.js"></script>

<script>

    new Vue({
        el: "#app",
        data: {
            services: JSON.parse(localStorage.getItem('services')),
        },
        mounted: function () {
            layui.use(['form', 'table','laydate'], function () {
                var $ = layui.jquery,
                    form = layui.form,
                    table = layui.table,laytpl=layui.laytpl;

                table.render({
                    elem: '#currentTableId',
                    where:form.val('table-search'),
                    url: '/admin/online/paginate',
                    defaultToolbar: ['filter', 'print' ],
                    toolbar: '#toolbarDemo',
                    cols: [[
                        {title: '服务器ID', field:'serverId' },
                        {title: '在线人数', field:'onlines', },

                    ]],
                    limits: [10, 15, 20, 25, 50, 100],
                    limit: 15,
                    page: true,
                    skin: 'line'
                });
                // 监听搜索操作
                form.on('submit(data-search-btn)', function () {
                    //执行搜索重载
                    table.reload('currentTableId', {
                        page: {
                            curr: 1
                        }
                    }, 'data');
                    return false;
                });


            });
        }
    })
</script>
</body>
</html>